package com.xie.smfs.damage;

import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.damage.DamageType;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;

public class ModDamageSources {
    // 定义 DamageType 的 RegistryKey
    public static final RegistryKey<DamageType> GHOST =
            RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier("smfs", "ghost"));
    public static final RegistryKey<DamageType> GHOST_PORCELAIN_CURSE =
            RegistryKey.of(RegistryKeys.DAMAGE_TYPE, new Identifier("smfs", "ghost_porcelain_curse"));

    // 获取 DamageSource 的方法
    public static DamageSource of(World world, RegistryKey<DamageType> key) {
        return world.getDamageSources().create(key); // 1.20.1+ 推荐方式
    }

    // 直接获取预定义的 DamageSource
    public static DamageSource ghost(World world) {
        return of(world, GHOST);
    }

    public static DamageSource ghostPorcelainCurse(World world) {
        return of(world, GHOST_PORCELAIN_CURSE);
    }
}